package com.example.untils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.Page;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author : ssy
 * @date: 2024-05-29
 * @Description:
 */
public class MapUtils {

    public static Map<String, Object> getMap(Page<?> page, List<?> dataList) {
        Map<String, Object> map = new HashMap<>();
        map.put("total", page.getTotal());
        map.put("pageNum", page.getPageNum());
        map.put("pageSize", page.getPageSize());
        map.put("list", dataList);
        return map;
    }

    public static Map<String, Object> getMapMp(IPage<?> page) {
        Map<String, Object> map = new HashMap<>();
        map.put("total", page.getTotal());
        map.put("current", page.getCurrent());
        map.put("size", page.getSize());
        map.put("list", page.getRecords());
        return map;
    }

}
